package com.edu.demo.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.apache.logging.log4j.util.Strings;

/**
 * <p>
 * 项目任务表
 * </p>
 *
 * @author jixuewei
 * @since 2023-01-12
 */
@ApiModel(value = "Task对象", description = "项目任务表")
public class Task implements Serializable,Comparable<Task> {

    private static final long serialVersionUID = 1L;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer projectId;

    @ApiModelProperty("任务标题")
    private String title;

    private String content;

    @ApiModelProperty("任务排序")
    @Getter@Setter
    private Integer sort;

    @ApiModelProperty("负责人")
    private String charger;

    @ApiModelProperty("0未开始，1已完成，2已完成")
    private Byte status;

    @ApiModelProperty("完成时间")
    private LocalDateTime finishTime;

    @ApiModelProperty("任务备注")
    private String remark;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getProjectId() {
        return projectId;
    }

    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getCharger() {
        return charger;
    }

    public void setCharger(String charger) {
        this.charger = charger;
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public LocalDateTime getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(LocalDateTime finishTime) {
        this.finishTime = finishTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        if(Strings.isEmpty(remark))
            this.remark = "无";
        this.remark = remark;
    }



    @Override
    public String toString() {
        return "Task{" +
            "id = " + id +
            ", projectId = " + projectId +
            ", title = " + title +
            ", content = " + content +
            ", charger = " + charger +
            ", status = " + status +
            ", finishTime = " + finishTime +
            ", remark = " + remark +
        "}";
    }

    @Override
    public int compareTo(Task task) {
        return this.sort - task.sort;
    }
}
